﻿#include "OiPCH.hpp"
#include "ui_OiGuideProduct.h"

namespace Oi
{
    namespace PLScannerCore
    {
        class myDefinitionPointDlg : public QDialog
        {
        public:
            myDefinitionPointDlg(const DefinitionType mtype, QWidget* parent);

            void setPoint(const DefinitionPoint& mp);

            void point(DefinitionPoint& mp);

        public:
            DefinitionType type;
            QLineEdit* xValue;
            QLineEdit* ylValue;
            QLineEdit* y2Value;
            QComboBox* additionType;
            QDialogButtonBox* buttons;
        };
        class GuideProductDlgImpl : public Impl<GuideProductDlg>
        {
        public:
            void init();
            
            bool checkIsValid();
            double getAirtightValue(double pos);      //气密层数据
            double getProfileValue(double pos);        //气密层数据 + 过渡层
            void updateProfile();
            DefinitionPoint setDefinitionPoint(double distance, double value);
        public:
            ProfileView* _view;
            QTableWidget* _table;
            QLineEdit* _width;
            QLineEdit* _thickness;
            QPushButton* _insert;
            QPushButton* _remove;
            QPushButton* _edit;
            
        public:
            ProductParams _params;
            QString _formalName;
            QList<QPointF> _lstMeasurePoint;

            //气密层数据
            double _width1;
            double _edgePos1;
            double _edgeThickness1;
            double _mediumPos1 ;
            double _mediumThickness1 ;

            //过渡层数据
            double _width2 ;
            double _edgePos2 ;
            double _edgeThickness2 ;
            double _mediumPos;      
            double _mediumThickness;
            double _mediumPos2 ;
            double _mediumThickness2 ;
            double _mediumPos3;
            double _mediumThickness3;

        public:
            DefinitionType _type;
        public:
            Ui::guideProductDlg ui;
        };



        myDefinitionPointDlg::myDefinitionPointDlg(const DefinitionType mtype, QWidget* parent) : QDialog(parent)
        {
            setWindowTitle("控制点编辑");

            QVBoxLayout* layout = new QVBoxLayout(this);
            QFormLayout* editLayout = new QFormLayout();

            type = mtype;

            xValue = new QLineEdit(this);
            ylValue = new QLineEdit(this);
            y2Value = new QLineEdit(this);
            additionType = new QComboBox(this);
            additionType->addItems({ "连续点","突变点" });

            auto validator = new QDoubleValidator();
            validator->setRange(0.1, 999.0, 2);
            xValue->setValidator(validator);

            validator = new QDoubleValidator();
            validator->setRange(0.1, 99.9, 2);
            ylValue->setValidator(validator);
            y2Value->setValidator(validator);

            editLayout->addRow("位置", xValue);
            editLayout->addRow("左侧厚度", ylValue);
            editLayout->addRow("右侧厚度", y2Value);
            editLayout->addRow("类型", additionType);


            if (type & DT_HalfWidth)
            {
                y2Value->setEnabled(false);
            }

            buttons = new QDialogButtonBox(QDialogButtonBox::Cancel | QDialogButtonBox::Ok, this);

            layout->addLayout(editLayout);
            layout->addWidget(buttons);
        }

        void myDefinitionPointDlg::setPoint(const DefinitionPoint& mp)
        {
            xValue->setText(QString::number(mp.distance));
            ylValue->setText(QString::number(fabs(mp.thicknessLeft)));
            y2Value->setText(QString::number(fabs(mp.thicknessRight)));
            additionType->setCurrentIndex((mp.type & DT_Mutational) ? 1 : 0);

            update();
        }

        void myDefinitionPointDlg::point(DefinitionPoint& mp)
        {
            mp.distance = xValue->text().toDouble();
            mp.thicknessLeft = ylValue->text().toDouble();
            mp.thicknessRight = y2Value->text().toDouble();
            mp.type = type + (additionType->currentIndex() == 0 ? 0 : DT_Mutational);
            // mp.radius = rValue->text().toDouble();
        }

        bool GuideProductDlgImpl::checkIsValid()
        {
            OI_Q(GuideProductDlg);
            _width1 = ui._width1->text().toDouble();

            _mediumPos1 = ui._mediumPos1->text().toDouble();
            _mediumThickness1 = ui._mediumThickness1->text().toDouble();
            _edgePos1 = ui._edgePos1->text().toDouble() + _mediumPos1;
            _edgeThickness1 = ui._edgeThickness1->text().toDouble();
            _width2 = ui._width2->text().toDouble();

            _mediumPos = ui._mediumPos->text().toDouble();
            _mediumThickness = ui._mediumThickness->text().toDouble();
            _mediumPos2 = ui._mediumPos_2->text().toDouble() + _mediumPos;
            _mediumThickness2 = ui._mediumThickness_2->text().toDouble();
            if (_mediumThickness2 == 0.0)
            {
                _mediumThickness2 = _mediumThickness;
            }
            _mediumPos3 = ui._mediumPos_3->text().toDouble() + _mediumPos2;
            _mediumThickness3 = ui._mediumThickness_3->text().toDouble();
            if (_mediumThickness3 == 0.0)
            {
                _mediumThickness3 = _mediumThickness2;
            }
            _edgePos2 = ui._edgePos->text().toDouble() + _mediumPos3;
            _edgeThickness2 = ui._edgeThickness->text().toDouble();
            if (_width1 > 2000 || _width1 < 10)
            {
                if (QMessageBox::Yes == QMessageBox::information(q, GuideProductDlg::tr("提示"), GuideProductDlg::tr("请正确填写气密层材料总宽"), QMessageBox::Yes))
                {
                    return false;
                }
            }
            if (_edgePos1 > _width1 || _edgePos1 < 0)
            {
                if (QMessageBox::Yes == QMessageBox::information(q, GuideProductDlg::tr("提示"), GuideProductDlg::tr("请正确填写气密层边厚畸变点距离"), QMessageBox::Yes))
                {
                    return false;
                }
            }
            if (_edgeThickness1 > 100 || _edgeThickness1 < 0)
            {
                if (QMessageBox::Yes == QMessageBox::information(q, GuideProductDlg::tr("提示"), GuideProductDlg::tr("请正确填写气密层中厚"), QMessageBox::Yes))
                {
                    return false;
                }
            }
            if (_mediumThickness1 > 100 || _mediumThickness1 < _edgeThickness1)
            {
                if (QMessageBox::Yes == QMessageBox::information(q, GuideProductDlg::tr("提示"), GuideProductDlg::tr("请正确填写气密层中厚"), QMessageBox::Yes))
                {
                    return false;
                }
            }
            if (_mediumPos1 > _width1 || _mediumPos1 < 0)
            {
                if (QMessageBox::Yes == QMessageBox::information(q, GuideProductDlg::tr("提示"), GuideProductDlg::tr("请正确填写气密层边厚畸变点距离"), QMessageBox::Yes))
                {
                    return false;
                }
            }
            if (ui._type->currentIndex() == 1)
            {
                if (_width2 > 2000 || _width2 < 10)
                {
                    if (QMessageBox::Yes == QMessageBox::information(q, GuideProductDlg::tr("提示"), GuideProductDlg::tr("请正确填写过度层材料总宽"), QMessageBox::Yes))
                    {
                        return false;
                    }
                }
                if (_edgePos2 > _width1 || _edgePos2 < 0)
                {
                    if (QMessageBox::Yes == QMessageBox::information(q, GuideProductDlg::tr("提示"), GuideProductDlg::tr("请正确填写过度层边厚畸变点距离"), QMessageBox::Yes))
                    {
                        return false;
                    }
                }
                if (_edgeThickness2 > 100 || _edgeThickness2 < 0)
                {
                    if (QMessageBox::Yes == QMessageBox::information(q, GuideProductDlg::tr("提示"), GuideProductDlg::tr("请正确填写过度层边厚"), QMessageBox::Yes))
                    {
                        return false;
                    }
                }
                if (_mediumThickness2 > 100)
                {
                    if (QMessageBox::Yes == QMessageBox::information(q, GuideProductDlg::tr("提示"), GuideProductDlg::tr("请正确填写过度层中厚"), QMessageBox::Yes))
                    {
                        return false;
                    }
                }
                if (_mediumPos2 > _width2 || _mediumPos2 < 0)
                {
                    if (QMessageBox::Yes == QMessageBox::information(q, GuideProductDlg::tr("提示"), GuideProductDlg::tr("请正确填写气密层边厚畸变点距离"), QMessageBox::Yes))
                    {
                        return false;
                    }
                }

            }
            return true;
        }

        DefinitionPoint GuideProductDlgImpl::setDefinitionPoint(double distance, double value)
        {
            DefinitionPoint defPoint;
            defPoint.distance = distance;
            defPoint.thicknessLeft = value;
            return defPoint;
        }

        void GuideProductDlgImpl::updateProfile()
        {
            _params.profiles = ProductParams::createProfile(
                _params.materialsWidth,
                _params.definitionPoints,
                _params.materialsThickness);

            _view->chart()->updateProfiles(_params.profiles);

            _view->chart()->autoRange();
        }

        void GuideProductDlg::autoProfile()
        {
            OI_F(GuideProductDlg);
            d->_params.definitionPoints.clear();

            if (!d->checkIsValid())
            {
                return;
            }

            if (d->ui._type->currentIndex() == 1)
            {
                d->_params.materialsWidth = d->_width2;
                d->_params.materialsThickness = d->_edgeThickness1;
                QList<QPointF> lstPos;
                lstPos.append(QPointF(-1 * d->_width2 / 2, d->_mediumThickness1));
                lstPos.append(QPointF(-1 * d->_width1 / 2, d->_mediumThickness1));
                lstPos.append(QPointF(-1 * d->_width1 / 2, d->_mediumThickness1 - d->_edgeThickness1));
                lstPos.append(QPointF(-1 * d->_edgePos1, d->_mediumThickness1 - d->_edgeThickness1));
                lstPos.append(QPointF(-1 * d->_mediumPos1, 0));
                lstPos.append(QPointF(d->_mediumPos1, 0));
                lstPos.append(QPointF(d->_edgePos1, d->_mediumThickness1 - d->_edgeThickness1));
                lstPos.append(QPointF(d->_width1 / 2, d->_mediumThickness1 - d->_edgeThickness1));
                lstPos.append(QPointF(d->_width1 / 2, d->_mediumThickness1));
                lstPos.append(QPointF(d->_width2 / 2, d->_mediumThickness1));

                for (int index = 0; index < lstPos.size(); index++)
                {
                    d->_params.definitionPoints.append(d->setDefinitionPoint(lstPos[index].x(), lstPos[index].y()));
                }
                d->_params.definitionPoints.append(d->setDefinitionPoint(d->_width2 / 2, d->getProfileValue(d->_width2 / 2)));
                if (d->ui._filmBox->isChecked())
                {
                    double filmWidth = d->ui._filmWidth->value();
                    double filmPos = d->ui._filmPos->value();
                    double filmThickness = d->ui._filmThickness->value();
                    d->_params.definitionPoints.append(d->setDefinitionPoint(filmPos + filmWidth, d->getProfileValue(d->_width2 / 2)));
                    d->_params.definitionPoints.append(d->setDefinitionPoint(filmPos + filmWidth, d->getProfileValue(filmPos + filmWidth)));
                    d->_params.definitionPoints.append(d->setDefinitionPoint(filmPos, d->getProfileValue(filmPos + filmWidth)));
                    d->_params.definitionPoints.append(d->setDefinitionPoint(filmPos, d->getProfileValue(filmPos)));
                }
                d->_params.definitionPoints.append(d->setDefinitionPoint(d->_edgePos2, d->getProfileValue(d->_edgePos2)));
                d->_params.definitionPoints.append(d->setDefinitionPoint(d->_mediumPos3, d->getProfileValue(d->_mediumPos3)));
                d->_params.definitionPoints.append(d->setDefinitionPoint(d->_mediumPos2, d->getProfileValue(d->_mediumPos2)));
                d->_params.definitionPoints.append(d->setDefinitionPoint(d->_mediumPos, d->getProfileValue(d->_mediumPos)));
                d->_params.definitionPoints.append(d->setDefinitionPoint(-d->_mediumPos, d->getProfileValue(d->_mediumPos)));
                d->_params.definitionPoints.append(d->setDefinitionPoint(-d->_mediumPos2, d->getProfileValue(d->_mediumPos2)));
                d->_params.definitionPoints.append(d->setDefinitionPoint(-d->_mediumPos3, d->getProfileValue(d->_mediumPos3)));
                d->_params.definitionPoints.append(d->setDefinitionPoint(-d->_edgePos2, d->getProfileValue(d->_edgePos2)));

                if (d->ui._filmBox->isChecked())
                {
                    double filmWidth = d->ui._filmWidth->value();
                    double filmPos = d->ui._filmPos->value();
                    double filmThickness = d->ui._filmThickness->value();
                    d->_params.definitionPoints.append(d->setDefinitionPoint(-filmPos, d->getProfileValue(filmPos)));
                    d->_params.definitionPoints.append(d->setDefinitionPoint(-filmPos, d->getProfileValue(filmPos + filmWidth))); 
                    d->_params.definitionPoints.append(d->setDefinitionPoint(-filmPos - filmWidth, d->getProfileValue(filmPos + filmWidth)));
                    d->_params.definitionPoints.append(d->setDefinitionPoint(-filmPos - filmWidth, d->getProfileValue(d->_width2 / 2)));
                }

                d->_params.definitionPoints.append(d->setDefinitionPoint(-d->_width2 / 2, d->getProfileValue(d->_width2 / 2)));
                d->_params.definitionPoints.append(d->setDefinitionPoint(-d->_width2 / 2, d->_mediumThickness1));
                d->_params.definitionPoints.append(d->setDefinitionPoint(d->_width2 / 2, d->_mediumThickness1));

            }
            else
            {
                d->_params.materialsWidth = d->_width1;
                d->_params.materialsThickness = d->_edgeThickness1;
                d->_params.definitionPoints.append(d->setDefinitionPoint(-1 * d->_edgePos1, d->getAirtightValue(d->_edgePos1)));
                d->_params.definitionPoints.append(d->setDefinitionPoint(-1 * d->_mediumPos1, d->getAirtightValue(d->_mediumPos1)));
                d->_params.definitionPoints.append(d->setDefinitionPoint(d->_mediumPos1, d->getAirtightValue(d->_mediumPos1)));
                d->_params.definitionPoints.append(d->setDefinitionPoint(d->_edgePos1, d->getAirtightValue(d->_edgePos1)));
                d->_params.definitionPoints.append(d->setDefinitionPoint(d->_width1 / 2, d->getAirtightValue(d->_width1 / 2)));
                d->_params.definitionPoints.append(d->setDefinitionPoint(d->_width1 / 2, 0));
                d->_params.definitionPoints.append(d->setDefinitionPoint(-1 * d->_width1 / 2, 0));
                d->_params.definitionPoints.append(d->setDefinitionPoint(-1 * d->_width1 / 2, d->getAirtightValue(d->_width1 / 2)));
            }


            d->updateProfile();
        }

        double GuideProductDlgImpl::getAirtightValue(double pos)
        {
            double value = 0;
            double k = (_mediumThickness1 - _edgeThickness1) / (_mediumPos1 - _edgePos1);
            double b = _mediumThickness1 - k * _mediumPos1;
            int profilePos = (int)qAbs(pos);
            if (profilePos < _mediumPos1)
            {
                value = _mediumThickness1;
            }
            else if (profilePos < _edgePos1)
            {
                value = k * qAbs(pos) + b;
            }
            else
            {
                value = _edgeThickness1;
            }
            
            return value;
        }

        double GuideProductDlgImpl::getProfileValue(double pos)
        {
            if (qAbs(pos) >= _width1/2)
            {
                return _mediumThickness1 + _edgeThickness2;
            }
            double value = 0;
            double k1 = (_mediumThickness - _mediumThickness2) / (_mediumPos - _mediumPos2);
            double b1 = _mediumThickness - k1 * _mediumPos;

            double k2 = (_mediumThickness3 - _edgeThickness2) / (_mediumPos3 - _edgePos2);
            double b2 = _mediumThickness3 - k2 * _mediumPos3;
            double filmWidth = 0;
            double filmPos = 0;
            double filmThickness = 0;
            if (ui._filmBox->isChecked())
            {
                filmWidth = ui._filmWidth->value();
                filmPos = ui._filmPos->value();
                filmThickness = ui._filmThickness->value();
            }
            int profilePos = (int)qAbs(pos);
            if (profilePos < _mediumPos)
            {
                value = _mediumThickness;
            }
            else if (profilePos < _mediumPos2)
            {
                value = k1 * qAbs(pos) + b1;
            }
            else if (profilePos < _mediumPos3)
            {
                value = _mediumThickness3;
            }
            else if (profilePos < _edgePos2)
            {
                value = k2 * qAbs(pos) + b2;
            }
            else if (filmPos > 0 && profilePos <= filmPos)
            {
                value = _edgeThickness2;
            }
            else if (filmPos > 0 && profilePos <= filmPos + filmWidth)
            {
                value = _edgeThickness2 + filmThickness;
            }
            else
            {
                value = _edgeThickness2;
            }
            value += _mediumThickness1;
           
            return value;
        }

        void GuideProductDlg::setParams(const ProductParams params)
        {
            OI_F(GuideProductDlg);
            d->_params = params;

            d->updateProfile();
        }
        QList<QPointF> GuideProductDlg::getMeasurePoints()
        {
            OI_F(GuideProductDlg);
            return d->_lstMeasurePoint;
        }
        ProductParams GuideProductDlg::params() const
        {
            return OI_IMPL()->_params;
        }

        QString GuideProductDlg::formalName() const
        {
            return OI_IMPL()->_formalName;
        }

        void GuideProductDlg::closeEvent(QCloseEvent* evt)
        {
            OI_F(GuideProductDlg);
        }

        void GuideProductDlg::onUpdateProfile()
        {
            OI_IMPL()->updateProfile();
        }

        void GuideProductDlgImpl::init()
        {
            OI_Q(GuideProductDlg);
            
            _view = new ProfileView();
            ui.setupUi(q);
            ui._finish->setEnabled(false);
            ui._last->setEnabled(false);
            ui._filmBox->setChecked(false);
            QHBoxLayout* mainLayout = new QHBoxLayout(ui._chatView);
            mainLayout->addWidget(_view);
            ui._guideTab->setCurrentIndex(0);
            ui._type->setCurrentIndex(PLScanner::instance()->formalType);
            ui._guideTab->setTabEnabled(1, false);
            ui._guideTab->setTabEnabled(2, false);
            q->connect(ui._last, &QPushButton::clicked, q, &GuideProductDlg::onLast);
            q->connect(ui._next, &QPushButton::clicked, q, &GuideProductDlg::onNext);
            q->connect(ui._finish, &QPushButton::clicked, q, &GuideProductDlg::onFinished);
        }

        GuideProductDlg::GuideProductDlg(QWidget* parent)
            :Ctrl::Dialog(parent)
        {
            OI_I(GuideProductDlg)->init();
        }

        void GuideProductDlg::accept()
        {
            __super::accept();
        }
        void GuideProductDlg::onNext()
        {
            OI_F(GuideProductDlg);

            int index = d->ui._guideTab->currentIndex();
            switch (index)
            {
            case 0:
            {
                d->ui._guideTab->setTabEnabled(1, true);
                d->ui._guideTab->setCurrentIndex(index + 1);
                d->ui._last->setEnabled(true);
                return;
            }
            case 1:
            {
                d->_formalName = d->ui._formal->text();
                if (d->_formalName == "")
                {
                    if (QMessageBox::Yes == QMessageBox::information(this, GuideProductDlg::tr("提示"), GuideProductDlg::tr("请输入配方名称"), QMessageBox::Yes))
                    {
                        return ;
                    }
                }
                ProductParams params;

              
                if (ProductParams::checkName(d->_formalName))
                {
                    if (QMessageBox::Yes == QMessageBox::information(this, GuideProductDlg::tr("提示"), GuideProductDlg::tr("配方名称已存在"), QMessageBox::Yes))
                    {
                        return;
                    }
                }
                

                d->ui._guideTab->setTabEnabled(1, false);
                d->ui._guideTab->setTabEnabled(2, true);
                d->ui._guideTab->setCurrentIndex(index + 1);
                d->ui._next->setText("预览");
                if (d->ui._type->currentIndex() == 1)
                {
                    d->ui._transitionBox->setEnabled(true);
                }
                else
                {
                    d->ui._transitionBox->setEnabled(false);
                }
                d->ui._last->setEnabled(true);
                d->ui._finish->setEnabled(true);
                return;
            }
            default:
                break;
            }
            d->_params.specName = d->ui._formal->text();
            autoProfile();
            
        }
        void GuideProductDlg::onLast()
        {
            OI_F(GuideProductDlg);
            int index = d->ui._guideTab->currentIndex();
            switch (index)
            {
            case 1:
            {
                d->ui._last->setEnabled(false);
                d->ui._guideTab->setTabEnabled(0, true);
                d->ui._guideTab->setTabEnabled(1, false);
                d->ui._guideTab->setTabEnabled(2, false);
                d->ui._guideTab->setCurrentIndex(index - 1);
                return;
            }
            case 2:
            {
                d->ui._last->setEnabled(true);
                d->ui._guideTab->setTabEnabled(0, false);
                d->ui._guideTab->setTabEnabled(1, true);
                d->ui._guideTab->setTabEnabled(2, false);
                d->ui._guideTab->setCurrentIndex(index - 1);
            }
            default:
                break;
            }

        }
        void GuideProductDlg::onFinished()
        {
            OI_F(GuideProductDlg);
            if (!d->checkIsValid())
            {
                return;
            }
            autoProfile();
            if (d->ui._type->currentIndex() == 1)
            {
                QPointF point1(-1 * d->_width2 / 2 , d->getProfileValue(-1 * d->_width2 / 2)-d->_mediumThickness1);
                d->_lstMeasurePoint.append(point1);
                QPointF point2(-1 * d->_edgePos2, d->getProfileValue(-1 * d->_edgePos2) - d->_mediumThickness1 + d->getAirtightValue(d->_edgePos2));
                d->_lstMeasurePoint.append(point2);
                QPointF point3(-1 * d->_mediumPos3, d->getProfileValue(-1* d->_mediumPos3) - d->_mediumThickness1 + d->getAirtightValue(d->_mediumPos3));
                d->_lstMeasurePoint.append(point3);
                QPointF point4(-1 * d->_mediumPos2, d->getProfileValue(d->_mediumPos2) - d->_mediumThickness1 + d->getAirtightValue(d->_mediumPos2));
                d->_lstMeasurePoint.append(point4);
                QPointF point5(-1 * d->_mediumPos, d->getProfileValue(d->_mediumPos) - d->_mediumThickness1 + d->getAirtightValue(d->_mediumPos));
                d->_lstMeasurePoint.append(point5);
                QPointF point6(d->_mediumPos, d->getProfileValue(d->_mediumPos) - d->_mediumThickness1 + d->getAirtightValue(d->_mediumPos));
                d->_lstMeasurePoint.append(point6);
                QPointF point7(d->_mediumPos2, d->getProfileValue(d->_mediumPos2) - d->_mediumThickness1 + d->getAirtightValue(d->_mediumPos2));
                d->_lstMeasurePoint.append(point7);
                QPointF point8(d->_mediumPos3, d->getProfileValue(d->_mediumPos3) - d->_mediumThickness1 + d->getAirtightValue(d->_mediumPos3));
                d->_lstMeasurePoint.append(point8);
                QPointF point9(d->_edgePos2, d->getProfileValue(d->_edgePos2) - d->_mediumThickness1 + d->getAirtightValue(d->_edgePos2));
                d->_lstMeasurePoint.append(point9);
                QPointF point10(d->_width2 / 2 - 5, d->getProfileValue(d->_width2 / 2) - d->_mediumThickness1);
                d->_lstMeasurePoint.append(point10);
            }
            else
            {
                 QPointF point1(-1 * d->_width1 / 2 , d->getAirtightValue(-1 * d->_width1 / 2));
                 d->_lstMeasurePoint.append(point1);
                 QPointF point2(-1 * d->_edgePos1, d->getAirtightValue(d->_edgePos1));
                 d->_lstMeasurePoint.append(point2);
                 QPointF point3(-1 * (d->_mediumPos1 + d->_edgePos1)/2, d->getAirtightValue(-1 * (d->_mediumPos1 + d->_edgePos1) / 2));
                 d->_lstMeasurePoint.append(point3);
                 QPointF point4(-1 * d->_mediumPos1, d->getAirtightValue(d->_mediumPos1));
                 d->_lstMeasurePoint.append(point4);

                 QPointF point5(0, d->_mediumThickness1);
                 d->_lstMeasurePoint.append(point5);
                 QPointF point6(d->_mediumPos1, d->getAirtightValue(d->_mediumPos1));
                 d->_lstMeasurePoint.append(point6);
                 QPointF point7((d->_mediumPos1 + d->_edgePos1) / 2, d->getAirtightValue((d->_mediumPos1 + d->_edgePos1) / 2));
                 d->_lstMeasurePoint.append(point7);
                 QPointF point8(d->_edgePos1, d->getAirtightValue(d->_edgePos1));
                 d->_lstMeasurePoint.append(point8);
                 QPointF point9(d->_width1 / 2 , d->getAirtightValue(d->_width1 / 2));
                 d->_lstMeasurePoint.append(point9);
            }
            emit formalSignal();
            emit accept();
        }



        void GuideProductDlg::onSwitchModeChanged()
        {
            OI_F(GuideProductDlg);
         
           
        }

    }
}